package com.hqyj.controller;


import com.hqyj.pojo.Goods;
import com.hqyj.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * @ClassName Goods
 * @Description TODO
 * @Author ZhuYouWan
 * @Date 2022/8/31 14:13
 * @Version 1.0
 **/
@Controller
@RequestMapping("/goods")
public class GoodsController {
    @Autowired
    private GoodsService goodsService;
    @RequestMapping("/findGoodsAll")
    @ResponseBody
    public Map<String, Object> findGoodsAll(int pageNum, int pageSize, String condition){
        return goodsService.findGoodsAll(pageNum, pageSize, condition);
    }
    @RequestMapping("/findInfo")
    @ResponseBody
    public Map<String, Object> findInfo(){
        return goodsService.findInfo();
    }
    @RequestMapping("/insertGoods")
    @ResponseBody
    public Map<String, Object> insertGoods(Goods goods){
        System.out.println(goods);
        return goodsService.insertGoods(goods);
    }
    @RequestMapping("/deleteGoodsById")
    @ResponseBody
    public Map<String, Object> deleteGoodsById(int gId){
        return goodsService.deleteGoodsById(gId);
    }
    @RequestMapping("/updateGoodsById")
    @ResponseBody
    public Map<String, Object> updateGoodsById(Goods goods){
        return goodsService.updateGoodsById(goods);
    }
    @RequestMapping("/updateGoodsInfo")
    @ResponseBody
    public Map<String, Object> updateGoodsInfo(int gId){
        return goodsService.updateGoodsInfo(gId);
    }
    @RequestMapping("/findGoodsGNno")
    @ResponseBody
    public Map<String, Object> findGoodsGNo(String gNo){
        return goodsService.findGoodsGNno(gNo);
    }
}
